from api import log
from config import HOST


class ApiRecharge:
    #初始化
    def __init__(self,session):
        #获取session
        self.session = session
        #获取url
        #获取图片url
        self._url_img_code = HOST +"/common/public/verifycode/{}"
        #获取充值url
        self._url_recharge= HOST+"/trust/trust/recharge"
        pass
    #充值获取图片封装
    def api_img_code(self,random):
        log.info("正在调用获取充值获取图片接口，请求方法为get 请求url为：{}".format(self._url_img_code.format(random)))
        return self.session.get(url=self._url_img_code.format(random))
    #后台充值接口 封装
    def api_recharge(self):
        data={
            "paymentType":"chinapnrTrust",
            "amount":10000,
            "formStr":"reform",
            "valicode":"8888"
        }
        log.info("正在调用获取充值获取图片接口，请求方法为get 请求url为：{}，请求参数为{}".format(self._url_recharge,data))
        return self.session.post(url=self._url_recharge,data=data)